#include<iostream>
#include<algorithm>
using namespace std;

int main(){
	int arr[10];
	for(int i=0;i<10;i++){
		cin >> arr[i];
	}
//	sort(arr,arr+10);
	for(int i=0;i<10;i++){
		cout << arr[i] << " ";
	}
	cout << endl;
	
	sort(arr,arr+10,greater<int>());
	for(int i=0;i<10;i++){
		cout << arr[i] << " ";
	}
	cout << endl;
	return 0;
} 
